<?php
namespace app\admin\controller;

use app\common\controller\AdminController;
use app\common\logic\SysLogic;

class ProjectConfig extends AdminController
{
    public function index(){
        $sysLogic = new SysLogic();

        if (request()->isAjax()) {
            $param = input('param.');
            $jieguo = $sysLogic->_setProjectConfig($this->getProjectId(),$param);
            if (false === $jieguo) {
                $this->error('编辑失败');
            }
            else{
                $this->success('编辑成功');
            }
        }

        $model = $sysLogic->_getProjectConfig($this->getProjectId());
        if (empty($model)) {
            $model = [
                'if_own_sms' => 0,
            ];
        }

        $this->assign('model', $model);


        return $this->fetch();
    }
}
